π‘οΈ Sentinel: [CRITICAL] Fix SQL injection in metadata generation#200
π‘οΈ Sentinel: [CRITICAL] Fix SQL injection in metadata generation#200thebearwithabite wants to merge 1 commit intomasterfrom
Conversation
Identified and fixed a critical SQL injection vulnerability in `metadata_generator.py` where dictionary keys were used dynamically to construct SQL `INSERT` and `ALTER TABLE` queries. The fix leverages `PRAGMA table_info` and `.isidentifier()` to validate columns dynamically, neutralizing potential exploits while retaining functional flexibility. Co-authored-by: thebearwithabite <216692431+thebearwithabite@users.noreply.github.com>
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
π¨ Severity: CRITICAL
π‘ Vulnerability: SQL Injection via dictionary keys
π― Impact: An attacker injecting arbitrary keys into the file metadata mapping could execute unparameterized SQL operations, potentially extracting sensitive data, mutating tables, or dropping the schema via
INSERT OR REPLACEandALTER TABLE.π§ Fix: Refactored dynamic SQL generation in
metadata_generator.pyto enforce a strictly validated schema allowlist fetched viaPRAGMA table_info, ensuring keys map perfectly to existing database fields, while appending Python'sstr.isidentifier()as an additional defensive tier for new columns.β Verification: Verified fix securely filters injected keys without crashing operations via test script (
temp_mock.py). Recorded critical learning in.jules/sentinel.md.PR created automatically by Jules for task 4276451137286979743 started by @thebearwithabite